<!-- 
 *  Copyright [2014] UW-Parkside
 * Authors: Jasmine Griffiths, Matthew Zygowicz, Armando Narvaez
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
*/
-->
<!-- usermanager.php, the main view for viewing/adding more users to the system -->

<!--
		Current Permission Levels: Admin, View/Edit, View
		
		IMPORTANT: Sticky windows show only for "Admin" and "View/Edit" 

-->
<body>
    <?php
    if (strlen($errMsg) > 0) {//Display an error message, if there is one
        print "<div class='alert-box error'>";
        print "<strong>Error!</strong>";
        print "<p>";
        print $errMsg;
        print "</p>";
        print "</div>";
    }
    if (strlen($successMsg) > 0) {//Display a success message, if there is one
        print "<div class='alert-box success'>";
        print "<strong>Success!</strong>";
        print "<p>";
        print $successMsg;
        print "</p>";
        print "</div>";
    }
    ?>
    <div id="container">
        <div id="mainContent">
            <div>
                <p><img src="/resources/img/logoBanner.png" alt="KAT Banner"/></p><!-- Banner -->
                <hr />
                <?php include 'navigation.php'; ?><!-- Navigation Bar -->
                <p> Welcome to the Kenosha Area Transit Application manager.</p>
            </div>
            <div>
                <form>
                    <p>Filter</p>
                    <p>
                       <input type="text" id="searchFilter" placeholder="Username, Realm" />  <!-- <input type="reset" value="Clear"> -->
                    </p>
                </form>
            </div>
<!--
            //FIXME -->
            <?php
            if ($_SESSION['realm'] != 'View') {//Show sticky window, if user permission is above "View" credentials
                echo "<div id='reducedResolution'>";
                include 'hiddenUserBoxMin.php';
                echo "</div>";
            }
            include 'pagination.php';//Pagination for table
            ?> 

            <table id="minimalistTable" class="tableizer-table">
			<!-- -----Table Headers (Columns) ------------->
                <thead class="tableizer-firstrow">
                <th class="hidden">id</th>
                <th>Username</th>            
                <th>Realm</th>
                </thead>
			<!-- ----End Table Headers (Columns)------------>	
                <tbody id = "tableFilter"> 
                    <?php
                    foreach ($userList as $user) {//Display users from database
                        print "<tr class='clickable' onclick=\"populateUserEntryForm('{$user['iUid']}','{$user['vcUsername']}','{$user['vcRealm']}');"
                        . "                                    populateUserEntryForm2('{$user['iUid']}','{$user['vcUsername']}','{$user['vcRealm']}')\">";
                        print "<td class='hidden'>{$user['iUid']}</td>";
                        print "<td>{$user['vcUsername']}</td>";
                        print "<td>{$user['vcRealm']}</td>";
                        print "</tr>";
                    }
                    ?>
                </tbody>
            </table>
        </div> <!-- Pagination div -->
    </div>
</div>
<div id="sideContent">
    <?php
    if ($_SESSION['realm'] != 'View') {//Display stick window if user permission level is above "View"
        echo "<div id='sticker' class = 'stick'>";
        include 'hiddenUserBox.php';
        echo "</div>";
    }
    ?> 
</div>
<div class="clear"></div>
</body>
<div id="site-footer">Kenosha Area Transit Manager developed by UW-Parkside 2014</div>